package edu.scnu.fans.fingertip.item.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import edu.scnu.fans.fingertip.item.output.ItemOutput;
import lombok.Data;

import java.time.Instant;

/**
 * 商品表
 */
@Data
@TableName("item")
public class Item {

    /**
     * 上架状态
     */
    public static final int UP_STATUS = 1;
    /**
     * 下架状态
     */
    public static final int DOWN_STATUS = 0;

    @TableId(type = IdType.AUTO)
    private Long id;

    private Instant created;
    private Instant updated;
    private boolean deleted;

    /** 状态 0:下架; 1上架 */
    private String status;
    /** 商品标题 */
    private String title;
    /** 商品介绍 */
    private String content;
    
    public ItemOutput transferToOutput() {
        return new ItemOutput(id, status, title, content);
    }

}
